<template>
	<view class="details" v-if="pageType == 5 || pageType == 6">
		<view class="topBox flex_space_b">
			<view class="item flex1 phone">账户</view>
			<view class="item flex1 time">办理时间</view>
		</view>
		<view class="list"  v-if="0 < orderList.length">
			<view class="item flex_space_b" v-for="(item, index) in orderList" :key="index">
				<view class="flex1 phone">{{item.k_account}}</view>
				<view class="flex1 time">{{item.k_create_at}}</view>
			</view>
		</view>
		<view class="noContent" v-else>
			<image class="noContentImage" src="@/static/empty.png" mode="widthFix"></image>
			<view class="text">没有相关记录~</view>
		</view>
	</view>
	<view class="details" v-else>
		<view class="topBox flex_space_b">
			<view class="item flex1 number" v-if="numberShow">号码编号</view>
			<view class="item flex1 phone">手机号</view>
			<view class="item flex1 time">办理时间</view>
		</view>
		<view class="list"  v-if="0 < orderList.length">
			<view class="item flex_space_b" v-for="(item, index) in orderList" :key="index">
				<view class="flex1 number" v-if="numberShow">{{item.mobile_number}}</view>
				<view class="flex1 phone">{{item.mobile_code}}</view>
				<view class="flex1 time">{{item.created_at}}</view>
			</view>
		</view>
		<view class="noContent" v-else>
			<image class="noContentImage" src="@/static/empty.png" mode="widthFix"></image>
			<view class="text">没有相关记录~</view>
		</view>
	</view>
</template>

<script>
	var util = require('../../common/util.js');
	export default {
		data() {
			return {
				numberShow: false,
				pageType:'',
				orderList:[],
				j_user_id:'',
				is_me:0,
				click_j_parent_admin_user:0
			}
		},
		onLoad (options) {
			// 当前选择的校区代理
			if(uni.getStorageSync('click_j_parent_admin_user') && uni.getStorageSync('click_j_parent_admin_user') != 0){
				this.click_j_parent_admin_user = uni.getStorageSync('click_j_parent_admin_user')
			}
			if (options.pageType) {
				let pageTitle = ''
				let numberShow = false;
				switch (options.pageType){
					case '1':
						pageTitle = '新生办卡'
						numberShow = true;
						break;
					case '2':
						pageTitle = '老生办卡'
						numberShow = true;
						break;
					case '3':
						pageTitle = '充100送100'
						break;
					case '4':
						pageTitle = '充50送50'
						break;
					case '5':
						pageTitle = '宽带订单'
						break;
					case '6':
						pageTitle = '入网订单'
						break;
					case '7':
						pageTitle = '和彩订单'
						break;			
					default:
						break;
				}
				uni.setNavigationBarTitle({
					title: pageTitle
				})
				this.numberShow = numberShow;
				this.pageType = options.pageType;
				this.is_me = options.is_me
			}
			if(options.j_user_id){
				this.j_user_id = options.j_user_id;
			}
			this.getOrderList();
		},
		methods: {
			getOrderList(){
				
				util.requestPost('user/getOrderList', {pageType:this.pageType,j_user_id:this.j_user_id,is_me:this.is_me,j_parent_admin_user:this.click_j_parent_admin_user}, (res) => {
					if (res.code == 1) {
						console.log(res);
						this.orderList = res.data.list;
						
					} else {
						
					}
				}, (err) => {
					console.log(err);
				}, {isShowLoading: false});
			}
		}
	}
</script>

<style scoped lang="scss">
.topBox {
	font-size: 28rpx;
	font-weight: bold;
	text-align: center;
	line-height: 100rpx;
	border-bottom: $border-base;
	background-color: #FFFFFF;
	position: sticky;
	top: 0;
	left: 0;
	z-index: 50;
	width: 750rpx;
	.item {
		&.number {
			max-width: 25%;
		}
	}
}
.list {
	color: #666666;
	font-size: 26rpx;
	text-align: center;
	line-height: 80rpx;
	.item {
		border-bottom: $border-base;
		.number {
			max-width: 25%;
		}
	}
}
</style>
